Add semantic-non-null support to CLI and snapshot tests#9611
Merged
tobias-tengler merged 2 commits intomainfrom Apr 28, 2026
Merged
Add semantic-non-null support to CLI and snapshot tests#9611tobias-tengler merged 2 commits intomainfrom
tobias-tengler merged 2 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a --semantic-non-null schema export path that rewrites SDL output fields from non-null wrappers to @semanticNonNull annotations, and wires this through formatting/export surfaces (CLI, HTTP schema endpoint) with updated docs/tests.
Changes:
- Add
SchemaFormatterOptions.RewriteToSemanticNonNulland apply it insideSchemaFormatter. - Add CLI
--semantic-non-nulloption toschema export, routing throughSchemaFileExporter. - Update/move semantic-non-null rewriter namespace and add/adjust snapshots + tests.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md | Documents removal of runtime semantic-non-null behavior in v16 and explains how to still emit annotated SDL via formatter/endpoint/CLI. |
| src/HotChocolate/Core/test/Types.Abstractions.Tests/Serialization/SemanticNonNullSchemaRewriterTests.cs | Updates test namespace/imports to match rewriter move. |
| src/HotChocolate/Core/src/Types/Execution/Internal/SchemaFileExporter.cs | Adds semantic-non-null rewrite support to schema file export (used by CLI). |
| src/HotChocolate/Core/src/Types.Abstractions/Serialization/SemanticNonNullSchemaRewriter.cs | Moves rewriter into HotChocolate.Serialization namespace. |
| src/HotChocolate/Core/src/Types.Abstractions/Serialization/SchemaFormatterOptions.cs | Adds RewriteToSemanticNonNull formatter option. |
| src/HotChocolate/Core/src/Types.Abstractions/Serialization/SchemaFormatter.cs | Applies RewriteToSemanticNonNull post-processing during schema formatting. |
| src/HotChocolate/Core/src/Types.Abstractions/HotChocolate.Types.Abstractions.csproj | Adds InternalsVisibleTo for HotChocolate.Types.Abstractions.Tests. |
| src/HotChocolate/AspNetCore/test/AspNetCore.CommandLine.Tests/snapshots/SchemaExportCommandTests.App_Should_WriteSemanticNonNullSchemaToFile_When_SemanticNonNullOptionIsSpecified.md | New snapshot validating semantic-non-null schema export output. |
| src/HotChocolate/AspNetCore/test/AspNetCore.CommandLine.Tests/snapshots/SchemaExportCommandTests.App_Should_OutputCorrectHelpTest_When_HelpIsRequested.snap | Updates CLI help snapshot with the new option. |
| src/HotChocolate/AspNetCore/test/AspNetCore.CommandLine.Tests/SchemaExportCommandTests.cs | Adds test coverage for --semantic-non-null export. |
| src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Formatters/DefaultHttpResponseFormatter.cs | Switches semantic-non-null schema output to use SchemaFormatter option instead of manual rewrite. |
| src/HotChocolate/AspNetCore/src/AspNetCore.CommandLine/Options/SemanticNonNullOption.cs | Introduces the new CLI option definition. |
| src/HotChocolate/AspNetCore/src/AspNetCore.CommandLine/Command/ExportCommand.cs | Wires the new option into schema export and passes it to the exporter. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
381a5c7 to
8d3071e
Compare
This was referenced May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.